package com.scy.hospitalmanager.until;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import org.apache.commons.lang.StringUtils;

/**
 * @Author Song_can_yu
 * @ClassName SplitString
 * @Date 2021-08-08-21:23
 * @PackageName com.scy.hospitalmanager.until
 * @Description 分割字符串工具类
 */
public class SplitString {
    public static List<Double> ToDoubleList(String getString){
        List<Double> doubleList = new ArrayList<Double>();
        if (getString==null){
            return  doubleList;
        }
        String[] stringArr =  getString.split(",");
//        System.out.println(stringArr);
        double[] intArr = Arrays.stream(stringArr).mapToDouble(Double::parseDouble).toArray();
        doubleList = Arrays.stream(intArr).boxed().collect(Collectors.toList());
        return doubleList;
    }
    public static List<Integer> ToList(String getString){
        List<Integer> integersList = new ArrayList<Integer>();
         if (getString==null){
            return  integersList;
        }
        String[] stringArr =  getString.split(",");
//        System.out.println(stringArr);
        int[] intArr = Arrays.stream(stringArr).mapToInt(Integer::parseInt).toArray();
        integersList = Arrays.stream(intArr).boxed().collect(Collectors.toList());
        return integersList;
    }
}
